package com.qipay.api;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by dong on 2016/6/6.
 */
@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableWebMvc
@EnableAsync
public class AppConfig extends WebMvcConfigurerAdapter implements EmbeddedServletContainerCustomizer {
    @Override
    public void customize(ConfigurableEmbeddedServletContainer factory) {
//        factory.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/403"));
//        factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404"));
//        factory.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500"));
//        factory.addErrorPages(new ErrorPage(HttpStatus.BAD_GATEWAY, "/503"));
    }

    //    @Bean
//    public HttpMessageConverter<String> responseBodyConverter() {
//        StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
//        return converter;
//    }
//
//    @Override
//    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
//        super.configureMessageConverters(converters);
//        converters.add(responseBodyConverter());
//    }

}
